package com.five.mobile.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.five.core.exception.CustomerException;
import com.five.core.result.ResultEnum;
import com.five.mobile.service.OrderService;
import com.five.pojo.entity.Order;
import com.five.pojo.entity.OrderItem;
import com.five.pojo.vo.OrderDetailVO;
import com.five.pojo.vo.OrderListVO;
import com.five.service.CommonOrderService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class OrderServiceImpl implements OrderService {

    @DubboReference(interfaceClass = CommonOrderService.class,check = false)
    private CommonOrderService commonOrderService;

    @Override
    public String createOrder(Order order, List<OrderItem> orderItems) {

        return commonOrderService.createOrder(order,orderItems);
    }

    @Override
    public OrderDetailVO getOrderDetail(Long orderId) {
        return commonOrderService.getOrderDetail(orderId);
    }

    @Override
    public OrderDetailVO getOrderDetailByNo(String orderNo) {
        return commonOrderService.getOrderDetailByNo(orderNo);
    }

    @Override
    public boolean cancelOrder(Long orderId, String cancelReason) {
        return commonOrderService.cancelOrder(orderId,cancelReason);
    }

    @Override
    public boolean payOrder(String orderNo, Integer payType) {
        return commonOrderService.payOrder(orderNo,payType);
    }

    @Override
    public boolean confirmReceive(Long orderId) {
        return commonOrderService.confirmReceive(orderId);
    }

    @Override
    public Page<OrderListVO> getUserOrders(Long userId, Integer pageNum, Integer pageSize) {
        return commonOrderService.getUserOrders(userId,pageNum,pageSize);
    }
}
